home *** CD-ROM | disk | FTP | other *** search
/ InterCD 2000 September / september_2000.iso / intercd / root / ^Linux / cfengine-1.5.3 / src / errors.c < prev    next >
Encoding:
C/C++ Source or Header  |  1999-04-06  |  2.2 KB  |  97 lines

  1. /* 
  2.  
  3.         Copyright (C) 1995
  4.         Free Software Foundation, Inc.
  5.  
  6.    This file is part of GNU cfengine - written and maintained 
  7.    by Mark Burgess, Dept of Computing and Engineering, Oslo College,
  8.    Dept. of Theoretical physics, University of Oslo
  9.  
  10.    This program is free software; you can redistribute it and/or modify it
  11.    under the terms of the GNU General Public License as published by the
  12.    Free Software Foundation; either version 2, or (at your option) any
  13.    later version.
  14.  
  15.    This program is distributed in the hope that it will be useful,
  16.    but WITHOUT ANY WARRANTY; without even the implied warranty of
  17.    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  18.    GNU General Public License for more details.
  19.  
  20.   You should have received a copy of the GNU General Public License
  21.   along with this program; if not, write to the Free Software
  22.   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA
  23.  
  24. */
  25.  
  26.  
  27. /*******************************************************************/
  28. /*                                                                 */
  29. /* Errors                                                          */
  30. /*                                                                 */
  31. /*******************************************************************/
  32.  
  33. #include "cf.defs.h"
  34. #include "cf.extern.h"
  35.  
  36.  
  37. FatalError(s)
  38.  
  39. char *s;
  40.  
  41. {
  42. fprintf (stderr,"%s:%s:%s\n",VPREFIX,VCURRENTFILE,s);
  43. SILENT = true;
  44. ReleaseCurrentLock();
  45. closelog(); 
  46. exit(1);
  47. }
  48.  
  49. /*********************************************************************/
  50.  
  51. Warning(s)
  52.  
  53. char *s;
  54.  
  55. {
  56. if (WARNINGS)
  57.    { 
  58.    fprintf (stderr,"%s:%s:%d: Warning: %s\n",VPREFIX,VCURRENTFILE,LINENUMBER,s);
  59.    }
  60. }
  61.  
  62. /*********************************************************************/
  63.  
  64. ResetLine(s)
  65.  
  66. char *s;
  67.  
  68. { int c;
  69.   int v;
  70.   char *p;
  71.  
  72. v = 0;
  73. while (isdigit(*s))
  74.    {
  75.    v = 10*v + *s++ - '0';
  76.    }
  77. LINENUMBER = v-1;
  78.  
  79. c = *s++;
  80. while (c == ' ')
  81.    {
  82.    c = *s++;
  83.    }
  84.  
  85. if (c == '"')
  86.    {
  87.    p = VCURRENTFILE;
  88.    c = *s++;
  89.    while (c && c != '"')
  90.       {
  91.       *p++ = c;
  92.       c = *s++;
  93.       }
  94.    *p = '\0';
  95.    }
  96. }
  97.